Continue reading in 'read-event' etc. at the end of a keyboard macro
authorTim Ruffing <crypto@timruffing.de>
Wed, 27 Dec 2023 13:32:09 +0000 (14:32 +0100)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 10 Mar 2024 14:40:13 +0000 (10:40 -0400)
commit6f46dd516b84ad7d59b49c2e9e3fc1a2d4ef4d1c
tree4075841773bcb6992af91b1ec81b21d6c0b96f9e
parentd6f326452ecc761498d627a365c8014a467812eb
Continue reading in 'read-event' etc. at the end of a keyboard macro

This fixes a bug that could make 'read-event', 'read-char', and
'read-char-exclusive' erroneously return -1, an internal magic return
value of 'read_char' leaked from C to lisp. Instead of returning -1, the
aforementioned lisp functions now transparently continue reading
available input (e.g., from the keyboard) when reaching the end of a
keyboard macro.

* src/keyboard.c (read_char, read_key_sequence): Move handling
of the end of a keyboard macro from 'read_char' to its caller
'read_key_sequence', which is the only caller that can
meaningfully deal with this case.
* src/macros.c (Fexecute_kbd_macro): Document how the end of keyboard
macro is processed.
* etc/NEWS: Announce this change.
etc/NEWS
src/keyboard.c
src/macros.c